import React from 'react'
import eventBus from '../utils/eventBus'

export default function EventBusTest(props) {
    const [favor,setFavor] = React.useState("足球")
    React.useEffect(()=>{
        eventBus.addListener("changeFavor",function(params){
            setFavor(params)
        })
        props.sendChild("这是子传父的数据")
    },[])
  return (
    <div>
        <h2>子组件-------------------------------------------</h2>
        EventBusTest 喜欢{favor}
    <div>我是子组件：{props.msg}</div>
    </div>
  )
}
